package com.xjcs.saplingplan.adapter

import android.content.Context
import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import com.xjcs.saplingplan.databinding.ItemCountdownBinding
import com.xjcs.saplingplan.room.bean.countdown.CountdownBean

class CountdownAdapter(
    private val context: Context,
    private val dataList: MutableList<CountdownBean>
) : RecyclerView.Adapter<CountdownAdapter.ItemCountdownViewHolder>() {

    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ItemCountdownViewHolder {
        val binding =
            ItemCountdownBinding.inflate(LayoutInflater.from(context), parent, false)
        return ItemCountdownViewHolder(binding)
    }

    override fun getItemCount(): Int = dataList.size

    override fun onBindViewHolder(holder: ItemCountdownViewHolder, position: Int) {
        val item = dataList.getOrNull(position)
        holder.bind(item)
    }

    class ItemCountdownViewHolder(binding: ItemCountdownBinding) :
        RecyclerView.ViewHolder(binding.root) {
        fun bind(item: CountdownBean?){
            item?.let {

            }
        }
    }

}